﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.International.Converters.PinYinConverter;

namespace Guog.Common.StringHelper
{
    public class StringHelper
    {
        public static string GetFirstPinYinChar(string str)
        {
            StringBuilder _result = new StringBuilder();
            if (!String.IsNullOrEmpty(str) && str.Trim().Length > 0)
            {
                foreach (char chr in str)
                {
                    if (ChineseChar.IsValidChar(chr))
                    {
                        _result.Append((new ChineseChar(chr)).Pinyins[0]);
                    }
                }
            }
            return _result.ToString();
        }
    }
}
